extends HTTPRequest

func downloadManual():
	download_file = DataStorageManager.path_manual
	var url = "http://" + Config.SERVER_ADDRESS + ":8080/downloadManual"
	var headers = ["Content-Type: application/json"]
	request(url, headers, HTTPClient.METHOD_POST)
	ObjectManager.toast.showToast("正在下载棋谱")


func _on_request_completed(result: int, _response_code: int, _headers: PackedStringArray, _body: PackedByteArray) -> void:
	if result == OK:
		ObjectManager.is_replay = true
		ObjectManager.main.jump_to_game()
	else:
		ObjectManager.toast.showToast("下载失败")
